import request from '@/utils/request'

// 添加
export function addAppointment(data) {
  return request({
    url: '/appointment/add',
    method: 'post',
    data: data
  })
}

// 编辑
export function editAppointment(data) {
  return request({
    url: '/appointment/edit',
    method: 'post',
    data: data
  })
}

// ID查询单个数据
export function getAppointment(id) {
  return request({
    url: '/appointment/info',
    method: 'post',
    params: { id }
  })
}

// 删除
export function delAppointment(id) {
  return request({
    url: '/appointment/delete',
    method: 'post',
    params: { id }
  })
}

// 批量删除
export function delListAppointment(idList) {
  return request({
    url: '/appointment/delete/list',
    method: 'post',
    data: idList
  })
}

// 查询分页数据
export function dataAppointment(query) {
  return request({
    url: '/appointment/data',
    method: 'post',
    params: query
  })
}

// 查询全部数据
export function allAppointment() {
  return request({
    url: '/appointment/all',
    method: 'post',
  })
}

// 条件查询列表数据
export function listAppointment(data) {
  return request({
    url: '/appointment/list',
    method: 'post',
    data: data
  })
}

// 根据字段、排序方式、limit条 查询列表数据
export function listLimitAppointment(field, sort, limit) {
  return request({
    url: '/appointment/list/limit',
    method: 'post',
    params: { field, sort, limit }
  })
}

// 根据字段查询列表数据
export function listFieldAppointment(field, value) {
  return request({
    url: '/appointment/list/field',
    method: 'post',
    params: { field, value }
  })
}

// 动态查询单个数据
export function dynamicGetAppointment(data) {
  return request({
    url: '/appointment/info/dynamic',
    method: 'post',
    data: data
  })
}

// 查看详情数据
export function detailsGetAppointment(id) {
  return request({
    url: '/appointment/details',
    method: 'post',
    params: { id }
  })
}

// 全部条数
export function countAppointment() {
  return request({
    url: '/appointment/count',
    method: 'post',
  })
}

// 条件查询条数
export function dynamicCountAppointment(data) {
  return request({
    url: '/appointment/count/dynamic',
    method: 'post',
    data: data
  })
}

export function statisticsAppointmentYear() {
  return request({
    url: '/appointment/statistics/year',
    method: 'post',
  })
}
